﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyVisionSystem
{
    public partial class Frm_Loading : Form
    {
        public Frm_Loading()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 定时器，用于定时刷新界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            this.panel2.Width += 10;
            if (this.panel2.Width >= this.panel1.Width)
            {
                this.timer1.Stop();
                this.DialogResult = DialogResult.OK;//模态窗体的情况下，可以通过DialogResult来返回窗体是否运行成功
            }
            //计算显示加载的百分比，显示到labellInfo控件的Text属性中
            this.labellInfo.Text = "加载中 [" + ((this.panel2.Width * 100) / this.panel1.Width).ToString() + "%]" ;
        }
    }
}
